home *** CD-ROM | disk | FTP | other *** search
/ The Atari Compendium / The Atari Compendium (Toad Computers) (1994).iso / files / prgtools / programm.ing / falcon / nt_dsp1.lzh / NT_DSP1.MSA / FLTS / IIR7.HLP < prev    next >
Encoding:
Text File  |  1989-01-24  |  4.0 KB  |  103 lines

  1. 2 IIR7
  2.          Name: IIR7.ASM
  3.          Type: Assembler Macro
  4.       Version: 1.0
  5.  Date Entered:  15-Jul-87
  6.   Last Change:  15-Jul-87
  7.  
  8.   Description: Cascaded Biquad Filters
  9.  
  10.  
  11.  Cascaded biquad filters are typically used when  the  transfer
  12.  function  can  be  decomposed  into  a product of second order
  13.  polynomials.  The magnitude of the coefficients of the  second
  14.  order  section  are  guaranteed to be less than 2.0 if the filter
  15.  is stable and minimum phase.  Since  the DSP56000 scaling modes
  16.  can implement 1 bit scaling directly, implementing cascaded second
  17.  order sections can be done efficiently.  The difference equation
  18.  for a second order section is:
  19.  
  20.      y(n) = a(1)y(n-1) + a(2)y(n-2) + x(n) + b(1)x(n-1) + b(2)x(n-2)
  21.  
  22.   with z transform:
  23.                          -1       -2    
  24.        Y(z)     1 + b(1)z  + b(2)z
  25.      ------- = ----------------------
  26.        X(z)              -1       -2
  27.                 1 - a(1)z  - a(2)z
  28.  
  29.   where:
  30.     x(n)  = input sample at time nT
  31.     y(n)  = output of the filter at time nT
  32.     a(n)  = filter coefficient n
  33.     b(n)  = filter coefficient n
  34.       T   = sample period
  35.  
  36.  When these sections are cascaded together, the z transform  of
  37.  the overall system is:
  38.                                                    
  39.                  M                 -1          -2                    
  40.        R(z)     ---   1 + b[n](1)z  + b[n](2)z
  41.      ------- =  | |  -------------------------
  42.        S(z)     | |               -1          -2
  43.                 n=1   1 - a[n](1)z  - a[n](2)z
  44.  
  45.  Where M is the total number of sections and [n] refers to  the
  46.  section  number.  A cascaded biquad filter with M=2 is shown below.
  47.  
  48.  s(n) Input      w[1](n)                       w[2](n)           Output
  49.  >-->(+)-----------------------(+)-(+)-----------------------(+)--> r(n)
  50.       ^            |            ^   ^            |            ^    
  51.       |           1/z           |   |           1/z           |    
  52.      (+)<-a[1](1)--|--b[1](1)->(+) (+)<-a[2](1)--|--b[2](1)->(+)   
  53.       |           1/z           |   |           1/z           |    
  54.      (+)<-a[1](2)--|--b[1](2)->(+) (+)<-a[2](2)--|--b[2](2)->(+)   
  55.                                                                          
  56.              Cascaded Second Order Biquad Filter
  57.              
  58.  
  59.  
  60.  For the filter kernel, the input sample  is  in  register
  61.  A  and  the  output  after filtering of a section is also
  62.  in register A.  This allows the next filter section to  be
  63.  executed  by  putting  the  filter kernel  inside  of a DO
  64.  loop.  The memory map for the cascaded biquad filter is shown
  65.  below.  Note in particular  the way  that  the filter states
  66.  are stored.  The first element is the second filter state 
  67.  and the second element  is  the  first filter  state.   Also
  68.  note the method of coefficient storage. The first element is
  69.  a(2) then a(1) followed by b(2) and b(1).
  70.  
  71.           r0
  72.           |
  73.           v
  74.       -----------------------------------------
  75.  X:   |         |         |         |         |
  76.       |w[1](n-1)|w[1](n-2)|w[2](n-2)|w[2](n-1)| Filter States
  77.       -----------------------------------------
  78.       <-    section 1   ->|<-   section 2    ->
  79.  
  80.           r4
  81.           |                    
  82.           v
  83.       -------------------------------------
  84.  Y:   |  a(2)  |  a(1)  |  b(2)  |  b(1)  | Section 1
  85.       | .711/2 | -1.29/2|   -.5  |  0.0   | Filter Coefficients
  86.       -------------------------------------
  87.  
  88.       -------------------------------------
  89.       |  a(2)  |  a(1)  |  b(2)  |  b(1)  | Section 2
  90.       | .807/2 | -1.64/2|   -.5  |  0.0   | Filter Coefficients
  91.       -------------------------------------
  92.  
  93.            Memory Map for the Biquad Filter
  94.  
  95.  Since 1 bit scaling is  used,  all  coefficients  are  the
  96.  actual value for the filter divided by two. The symbol "nsec"
  97.  refers to the number of biquad sections in the overall filter.
  98.  
  99.  For an example of how to use this filter see the test
  100.  program IIR7T.ASM
  101.  
  102.  
  103.